package com.example.project.manageController;

import com.example.project.dao.ParkingTypeDAO;
import com.example.project.pojo.ParkingType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("manage")
public class ManageUpdateParking_typeController {

    @RequestMapping("viewUpdateParkType")
    public String viewUpdateParkType(int id,Model model){
        ParkingTypeDAO parkingTypeDAO=new ParkingTypeDAO();
        ParkingType parkingType= parkingTypeDAO.viewUpParkingType(id);

        model.addAttribute("parkingType",parkingType);
        return "/manage/updateparking_type";
    }
    @RequestMapping("updateParkingType")
    public String updateParkingType(ParkingType parkingType){

        ParkingTypeDAO parkingTypeDAO=new ParkingTypeDAO();
        parkingTypeDAO.updateParkingType(parkingType);
        return "redirect:/manage/viewParking_type";
    }
}
